package com.atguigu.gulimall.order.frgin;

import com.atguigu.common.to.OrderTo;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.order.entity.OrderEntity;
import com.atguigu.gulimall.order.vo.WareSkuLockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 库存系统
 */
@FeignClient("gulimall-ware")
public interface WarsFeginService {

    /**
     * 检查是否有库存
     * @param skuIds
     * @return
     */
    @PostMapping("/ware/waresku/hasstock")
    R getSkusHasStock(@RequestBody List<Long> skuIds);

    /**
     * 计算运费
     * @param addrId
     * @return
     */
    @GetMapping("/ware/wareinfo/fare")
    R getFare(@RequestParam("addrId") Long addrId);

    /**
     * 为当前订单锁定库存
     * @param lockVo
     * @return
     */
    @PostMapping("/ware/waresku/lock/order")
    R orderLockStock(@RequestBody WareSkuLockVo lockVo);

    @PostMapping("/ware/waresku/order/createOrder")
    R createOrder(OrderTo orderTo);

    @PostMapping("/ware/waresku/order/updateOrder")
    R updateOrder(OrderTo orderTo);
}
